const STUDENTS = [
  {"id": 1, "name": "学生1"},
  {"id": 2, "name": "学生2"},
  {"id": 3, "name": "学生3"},
  {"id": 4, "name": "学生4"},
  {"id": 5, "name": "学生5"},
  {"id": 6, "name": "学生6"},
  {"id": 7, "name": "学生7"},
  {"id": 8, "name": "学生8"},
  {"id": 9, "name": "学生9"},
  {"id": 10, "name": "学生10"},
  {"id": 11, "name": "学生11"},
  {"id": 12, "name": "学生12"},
  {"id": 13, "name": "学生13"},
  {"id": 14, "name": "学生14"},
  {"id": 15, "name": "学生15"},
  {"id": 16, "name": "学生16"},
  {"id": 17, "name": "学生17"},
  {"id": 18, "name": "学生18"}
]

const RESULTS = [
    {"action":"upload","data":{"file":{"url": '/data/1.json'}}},
    {"action":"upload","data":{"file":{"url": '/data/2.json'}}},
    {"action":"upload","data":{"file":{"url": '/data/3.json'}}},
    {"action":"upload","data":{"file":{"url": '/data/4.json'}}},
]


const OPERATIONS = []

STUDENTS.forEach((student, index) => {
  if (index === 2) return;
  const data = index === 1 ? [RESULTS[0]] : RESULTS;
  data.forEach((d) => {
    const randomTime = new Date(Date.now() + Math.floor(3000000 * Math.random()));
    OPERATIONS.push({
      creator_id: student.id,
      creator_name: student.name,
      widget_id: 'pendulumTriangle-I1Ijqt',
      data: [d],
      created_at: randomTime.toISOString()
    });
  })
});

export default {
  async listOperations() {
    return {data: OPERATIONS};
  },

  async listStudents() {
    return STUDENTS.map((u) => ({id: u.id, name: u.name}))
  },
};
